home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / BlueCustom.swf / scripts / frame_609 / PlaceObject2_190_20 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2008-09-26  |  2.3 KB  |  93 lines

  1. onClipEvent(enterFrame){
  2.    if(die == 1)
  3.    {
  4.       if(this._x > 2100)
  5.       {
  6.          removeMovieClip(this);
  7.       }
  8.       if(this._x < -1400)
  9.       {
  10.          removeMovieClip(this);
  11.       }
  12.       this._xscale = mesize;
  13.       this._yscale = mesize;
  14.       myRadians = Math.atan2(this._y - _root.player._y,this._x - _root.player._x);
  15.       xleg = this._x - _root.player._x;
  16.       yleg = this._y - _root.player._y;
  17.       scared = Math.sqrt(xleg * xleg + yleg * yleg);
  18.       toploc = (_root.depth._y - this._y) * -1;
  19.       if(this._y < _root.depth._y)
  20.       {
  21.          air += 0.4;
  22.          if(this._rotation > 0)
  23.          {
  24.             if(this._rotation < 90)
  25.             {
  26.                this._rotation -= 3;
  27.             }
  28.          }
  29.          if(this._rotation < 180)
  30.          {
  31.             if(this._rotation > 90)
  32.             {
  33.                this._rotation += 3;
  34.             }
  35.          }
  36.       }
  37.       else if(air > 0.5)
  38.       {
  39.          air -= 0.5;
  40.       }
  41.       if(movey == 1)
  42.       {
  43.          this._x += _global.xgo;
  44.          this._y += _global.ygo + air;
  45.       }
  46.       this._x += Math.cos(3.141592653589793 * this._rotation / 180) * mespeed;
  47.       this._y += Math.sin(3.141592653589793 * this._rotation / 180) * mespeed;
  48.       if(scared < 300 - mespeed * 10)
  49.       {
  50.          if(toploc < 20)
  51.          {
  52.             if(_root.player._x < this._x)
  53.             {
  54.                this._rotation += 10;
  55.             }
  56.             else
  57.             {
  58.                this._rotation -= 10;
  59.             }
  60.          }
  61.          else
  62.          {
  63.             myDegrees = Math.round(myRadians * 180 / 3.141592653589793);
  64.             if(this._rotation > myDegrees)
  65.             {
  66.                this._rotation -= turnspeed;
  67.             }
  68.             if(this._rotation < myDegrees)
  69.             {
  70.                this._rotation += turnspeed;
  71.             }
  72.          }
  73.       }
  74.    }
  75.    else if(movey == 1)
  76.    {
  77.       this._x += _global.xgo;
  78.       this._y += _global.ygo;
  79.    }
  80.    if(this.eat.hitTest(_root.player.eat))
  81.    {
  82.       die = 0;
  83.       eat = new Sound();
  84.       eat.attachSound("eatit1");
  85.       eat.start(0,1);
  86.       this.gotoAndPlay("die");
  87.       scoreity = Math.round(scoreworth);
  88.       _root.instascore.text = "+" + scoreity;
  89.       _root.instascore._y = 430;
  90.       _global.scoreit = _global.scoreit * 1 + scoreity;
  91.    }
  92. }
  93.